package com.itheima.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.Page;
import com.itheima.entity.Preject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.po.IndexVisualizationPo;
import com.itheima.query.ProjectPageQuery;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author guanhuaer
 * @since 2024-09-05
 */
@Mapper
public interface PrejectMapper extends BaseMapper<Preject> {

    List<Preject> setlectall();

    Preject selsectTitle(String title);

    void insertProjectAdd(Preject preject);

    List<Preject> selectPages(ProjectPageQuery querys);

    void Deldects(String ids);

    void Deldect(Integer id);

    IPage pagecc(Page<Preject> page, @Param(Constants.WRAPPER) LambdaQueryWrapper<Preject> wrapper);

    Page<Preject> page(ProjectPageQuery query);

    void projectEdit(Preject preject);

    Integer countByMap(Map map);

    Integer countViewMap(Map map);

    /**
     * 查询每一天的项目数据
     * @param begins
     * @param ends
     * @param type
     * @return
     */
    List<Preject> selectExport(LocalDateTime begins, LocalDateTime ends, String type);

    /**
     * 批量添加项目数据
     * @param prejects
     */
    void projectBatchAdd(List<Preject> prejects);

    List<Map<String, Object>> selectTeacherType();

    Preject selectProjectById(Integer id);

    /**
     * 查询首页可视化数据
     * @return
     */
    IndexVisualizationPo selectBaseInfo(Integer userId);
    IndexVisualizationPo selectBaseTeacherInfo(Integer userId);

    Map<String, Object> selectProjectThirtydayData(LocalDateTime startDay,LocalDateTime endDay);

    Map<String, Object> selectProjectMonthData(LocalDateTime startDay, LocalDateTime endDay);

    Map<String, Long> getProjectVisit(LocalDateTime startTime, LocalDateTime endTime);

    Integer getProjectTypeBar(LocalDateTime startTime, LocalDateTime endTime, int occupation);

    Integer getProjectTypePie(LocalDateTime startTime, LocalDateTime endTime, int status);

    Integer getProjectMapData(String address, LocalDateTime startTime, LocalDateTime endTime);

    Map<String, String> projectLineData(LocalDateTime startTime, LocalDateTime endTime);

    Map<String, Object> getProjectProgress(LocalDateTime startTime, LocalDateTime endTime);

    IndexVisualizationPo selectProjectSubmitInfo(Integer userId);

    List<Integer> selectProjectIdsByUserId(Integer userId);
    List<Integer> selectProjectIdsByTeacherId(Integer userId);

    List<Preject> selectProjectByIds(Integer[] ids);
}
